﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bes.Swsp.ToolBox
{
  /// <summary>
  /// A class representing an inlet in the storm drainage netowrk.
  /// </summary>
  public class InletNode : TransitionNode
  {
    private Catchment _catchment;

    public InletNode()
      : base()
    {
    }

    public InletNode(int id)
      : base(id)
    {
    }

    public override NodeType Type
    {
      get
      {
        return NodeType.Inlet;
      }
    }

    /// <summary>
    /// The surface catchment area that flows directly into this inlet.
    /// </summary>
    public Catchment CatchmentArea
    {
      get
      {
        return _catchment;
      }

      set
      {
        if (_catchment != null)
        {
          _catchment.DrainageNode = null;
        }

        _catchment = value;

        if (_catchment != null)
        {
          _catchment.DrainageNode = this;
        }
      }
    }

    public override string ToString()
    {
      return string.Format("Inlet {0}", this.ID);
    }
  }
}
